package com.itheima.service.impl;

import com.itheima.mapper.StudentMapper;
import com.itheima.pojo.Student;
import com.itheima.pojo.User;
import com.itheima.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.print.Book;
import java.util.List;

/**
 * @author ChaunceyZhang
 * @date 2022-10-21 19:59
 * @blog1 https://zephyr-cyber.github.io/
 * @blog2 https://www.yuque.com/gougougou-xwscx
 */
@Service
public class StudentServiceImpl implements StudentService {
@Autowired
private StudentMapper studentMapper;


    @Override
    public User select(String name, String password) {
        User user = studentMapper.select(name, password);
        return user;
    }

    @Override
    public Boolean save(Student student) {
        return studentMapper.save(student) > 0;
    }

    @Override
    public Boolean update(Student student) {
        return studentMapper.update(student) > 0;
    }

    @Override
    public Boolean delete(Integer id) {
        return studentMapper.delete(id) > 0;
    }

    @Override
    public Book findById(Integer id) {
        return studentMapper.findById(id);
    }

    @Override
    public List<Student> findAll() {
        return studentMapper.findAll();
    }
}
